package com.kimwu.design.adapter.objectdapter;

/**
 * VoltageAdapter   class
 * 对象适配器
 */
public class ObjectVoltageAdapter implements ObjectIVoltage5V {

    private ObjectVoltage220V voltage220V;

    public ObjectVoltageAdapter(ObjectVoltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    @Override
    public int outPut5V() {
        int dst = 0;
        if (null != voltage220V) {
            //获取到220V电压
            int src = voltage220V.outPut220V();
            System.out.println("使用对象适配器进行转换");
            dst = src / 44;
        }
        return dst;
    }

}